#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin>>n;
    vector<int>v(n+1),w(n+1);
    w[1]=1;
    unordered_map<int, bool>mp;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        if(i>1)w[i]=w[i-1]+w[i-2];
        if(v[i]%w[i]==0)mp[v[i]/w[i]]=1;
    }
    int ans=INT_MAX;
    for(auto x:mp)
    {
        int tmp=0;
        for(int i=1;i<=n;i++)
        {
            if(v[i]%w[i]!=0||v[i]/w[i]!=x.first)tmp++;
        }
        ans=min(ans,tmp);
    }
    cout<<ans;
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}